
#ifndef DATABASE_H
#define	DATABASE_H

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cctype>

#include "sqlite3.h"
#include "packets.h"

/**
 * The database class. Functionality comments are in the source file.
 */

class database
{
public:
    database();
    ~database();

    void create();

    int write(char *query);
    sqlite3_stmt *read(char *query);

    int account_create(char *username, char *password, int access);
    int account_find( char *username, char *password);
    int table_row_count(const char *tablename);
    int table_row_count(const char *tablename, const char *where, const char *what);
    int table_row_count(const char *tablename, const char *where, const int what);
    int table_row_max(const char *tablename);
    int get_average_rating(int appid);
    void generate_string(char *str);
    void sendemail(char *email, char *subject, char *message);
    
private:
    sqlite3 *db;
};

#endif

